From 39637490aeb36be47265abb83321a5d36fbb9f33 Mon Sep 17 00:00:00 2001 From: Anya Lin Date: Fri, 26 Sep 2025 00:59:01 +0800 Subject: [PATCH] luci-mod-network: Correctly encode/decode ech field in HTTPS record Signed-off-by: Anya Lin --- .../htdocs/luci-static/resources/tools/dnsrecordhandlers.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/luci-mod-network/htdocs/luci-static/resources/tools/dnsrecordhandlers.js b/modules/luci-mod-network/htdocs/luci-static/resources/tools/dnsrecordhandlers.js index 6c5922a5a6..7d7f236088 100644 --- a/modules/luci-mod-network/htdocs/luci-static/resources/tools/dnsrecordhandlers.js +++ b/modules/luci-mod-network/htdocs/luci-static/resources/tools/dnsrecordhandlers.js @@ -163,6 +163,7 @@ return baseclass.extend({ return keys.map(n => [(n >> 8) & 0xff, n & 0xff]).flat(); case 'ech': // Assume ech is in base64 + return Array.prototype.map.call(atob(value), c => c.charCodeAt(0)); // OR Uint8Array.fromBase64(value) case 'alpn': /* (RFC 9460 §7.1.1 The wire-format value for "alpn" consists of at least one alpn-id prefixed by its length as a single octet */ @@ -320,6 +321,7 @@ return baseclass.extend({ return keys.join(','); case 'ech': + return btoa(String.fromCharCode(...buf)); // OR buf.toBase64() case 'alpn': { let pos = 0, result = []; while (pos < buf.length) { -- 2.30.2